<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
{include file="public/top"}
</head>
<body>
<article class="page-container">
	<form action="" method="post" class="form form-horizontal"  id="form-member-add">
    <a href="javascript:;" id="wx" class="btn btn-primary radius">微信商户配置信息</a>

    <a href="javascript:;" id="zfb" class="btn btn-primary radius">支付宝商户配置信息</a>

<!-- 微信 -->
	<div class="wx">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">商户名称：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<span class="select-box">
					<select class="select valid" size="1" name="mid" id="mid" >
						<option class="xz" value="" selected="">请选择商户</option>
						{volist name="merchant" id="sa"}
						<option class="xz" value="{$sa.id}">{$sa.name}</option>
						{/volist}
					</select>
					<input type="hidden" value="1" id="weixin">
				</span> 
			</div>
	</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>APPID：</label>
			<div class="formControls col-xs-8 col-sm-9">
			
				<input type="text" class="input-text" value="" placeholder="" id="appid" name="appid">
			
			</div>
		</div>
	
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>appSecret：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="appSecret" name="appSecret">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>微支付商户号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="mchId" name="mchId">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>微支付商户API秘钥：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="key" name="key">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>商品描述：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="body" name="body">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>支付页面title信息：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="zf_title" name="zf_title">
			</div>
		</div>
	
	
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">备注：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="beizhu" id="beizhu" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" onKeyUp="$.Huitextarealength(this,100)"></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
			</div>
		</div>
		
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input id="subm" class="btn btn-primary radius sty" type="button" str="1" value="提交">
			</div>
		</div>

	</div>
	</form>
	<!-- 支付宝 -->
	<div class="zfb">
	

	<form action="" method="post" class="form form-horizontal"  id="form-member-add">
	
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">备注：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="zfb_bz" id="zfb_bz" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" onKeyUp="$.Huitextarealength(this,100)"></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
			</div>
		</div>
		
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input id="subm" class="btn btn-primary radius sty" type="button" str="2" value="提交">
			</div>
		</div>

		<input type="hidden" name="types" value="2">

		</form>

	</div>

	
</article>

<!--_footer 作为公共模版分离出去-->
{include file="public/footer"}
<!--请在下方写此页面业务相关的脚本--> 
<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	
});
</script> 

<script type="text/javascript">
	//判断是否成功逻辑
$(function(){
  $('.sty').click(function(){
     var re = $(this).attr('str');
     if(re == 1){

     	var appid = $('#appid').val();
     	var appSecret = $('#appSecret').val();
     	var mchId = $('#mchId').val();
     	var key = $('#key').val();
     	var body = $('#body').val();
     	var zf_title = $('#zf_title').val();
     	var beizhu = $('#beizhu').val();
     	var mid = $('#mid option:selected').val();
        $.post("{:url('Shcon/medber_add_ad')}",{appid:appid,appSecret:appSecret,mchId:mchId,key:key,body:body,zf_title:zf_title,beizhu:beizhu,mid:mid,typesy:re},function(data){
            if(data == 0){
            	 layer.msg('修改配置成功',{icon: 1,time:2000,shade: [0.8, '#393D49']},function(index){	
							// var index = parent.layer.getFrameIndex(window.name);
							//parent.$('.btn-refresh').click();
							parent.layer.close(index);
							parent.window.location.href="{:url('Shcon/member_list')}";
						});	

            }else if(data == 1){
            	 layer.msg('修改配置失败请正确操作',{icon: 2,time:2000,shade: [0.8, '#393D49']},function(index){	
							// var index = parent.layer.getFrameIndex(window.name);
							//parent.$('.btn-refresh').click();
						//	parent.layer.close(index);
						//	parent.window.location.href="{:url('Shcon/member_list')}";
						});	


            }else if(data == 2){
            	layer.msg('添加配置成功',{icon: 1,time:2000,shade: [0.8, '#393D49']},function(index){	
							// var index = parent.layer.getFrameIndex(window.name);
							//parent.$('.btn-refresh').click();
							parent.layer.close(index);
							parent.window.location.href="{:url('Shcon/member_list')}";
						});	

            }else if(data == 3){
            	layer.msg('修改配置成功',{icon: 2,time:2000,shade: [0.8, '#393D49']},function(index){	
							// var index = parent.layer.getFrameIndex(window.name);
							//parent.$('.btn-refresh').click();
							//parent.layer.close(index);
							//parent.window.location.href="{:url('Shcon/member_list')}";
						});	

            }
        });


     }//在后面添加日后的配置项
  });


  //获取当前用户所有配置信息
  $('#mid').change(function(){
var user = $(this).children('option:selected').val();
   $.post("{:url('Shcon/member_add')}",{user:user},function(data){
     var a=JSON.parse(data);//将josn字符串转换为对象
     var appid = a.appid;
     var appSecret = a.appSecret;
     var mchId = a.mchId;
     var key = a.key;
     var body = a.body;
     var zf_title = a.zf_title;
     var beizhu = a.beizhu;

      $('#appid').val(appid);
      $('#appSecret').val(appSecret);
      $('#mchId').val(mchId);
      $('#key').val(key);
      $('#body').val(body);
      $('#zf_title').val(zf_title);
      $('#beizhu').val(beizhu);
   });

});
});

</script>
<script type="text/javascript">
	$(function(){
		$(".zfb").hide();
		$("#wx").click(function(){
			$(".zfb").hide();
			$(".wx").show();
		});
		$("#zfb").click(function(){
			$(".zfb").show();
			$(".wx").hide();
		});
	})
</script>
</body>
</html>